cmake_minimum_required(VERSION 3.10.0)
project(AntlrTest VERSION 0.1.0 LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(GEN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/generated)

set(GENERATED_SOURCES
    ${GEN_DIR}/TLexer.cpp
    ${GEN_DIR}/TLexer.h
    ${GEN_DIR}/TParser.cpp
    ${GEN_DIR}/TParser.h
    ${GEN_DIR}/TParserBaseListener.cpp
    ${GEN_DIR}/TParserBaseListener.h
    ${GEN_DIR}/TParserBaseVisitor.cpp
    ${GEN_DIR}/TParserBaseVisitor.h
    ${GEN_DIR}/TParserListener.cpp
    ${GEN_DIR}/TParserListener.h
    ${GEN_DIR}/TParserVisitor.cpp
    ${GEN_DIR}/TParserVisitor.h
)

add_subdirectory(${CMAKE_SOURCE_DIR}/deps/antlr4runtime)

add_executable(${CMAKE_PROJECT_NAME} 
    main.cpp
    ${GENERATED_SOURCES}
    )

target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE antlr4_static)

target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/deps/antlr4runtime/runtime/src)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${GEN_DIR})

include(CTest)
enable_testing()

